<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Hot Spot</title>
  <%= stylesheet_link_tag "ranking", :media => "all" %>
</head>
<body id="ranking-data">
  <div id="entry-list">
  	<h1>Access Ranking</h1>
  		<table cellpadding="50" cellspacing="0" with="300">
  			<%  i = 1
				rank = 1
				q = 1
				before = nil
				for ranking_data in @ranking_data 
			%>
			<colgroup>
					<col width="30">
					<col width="50">
					<col width="150">
					<col width="70">
					<col width="50">
			</colgroup>
				
   			<tr valign="top" class="<%= cycle('list-line-odd', 'list-line-even') %>">

   				<td  class = "list-number">
   					<%= "<img src=\"/images/icons/crown/crown#{rank.to_s}.gif\" width=\"22\" height=\"19\" style=\"margin:1px; border:1px solid #ccc;\">" %>
   				</td>
				<td>
					<%= image_tag(PICTURES_DIR + ranking_data.picture_url, :class => "list-image") %>
				</td>
     			<td class = "list-subject">
     			 		<%= h(ranking_data.subject) %>
      			</td>
				<td class="list-body">
					<%= h(truncate(ranking_data.body, 10)) %>
				</td>
      			<td class="list-actions">
        			<%= link_to 'Show ', :action => :show, :id => ranking_data %><br/>
      			</td>
    		</tr>
  			<% 
					if ranking_data.counter != before
						rank += q
						q = 1
						i += 1
					else
						q += 1
						i += 1
					end
					before = ranking_data.counter
				end
			%>
  		</table>
	</div>
</body>
</html>

